function showGroup(srcElement, id)
{
	var groupBox = document.getElementById(id);
	var children = srcElement.children;
	var childrenLen = children.length;
	var child = null;

	for (var i = 0; i < childrenLen; i++)
	{
		child = children.item(i);
		if (child.className == "sign") break;
	}

	var display = groupBox.style.display;

	if (display == "none")
	{
		child.innerHTML = "-";
		groupBox.style.display = "inline";
	}
	else
	{
		child.innerHTML = "+";
		groupBox.style.display = "none";
	}
}

function showTip(srcElement)
{
	var clientY = event.clientY;
	var clientX = event.clientX;

	var tipBox = document.getElementById("tipBox");

	if (tipBox.style.display == "none" || tipBox.style.display == "")
		tipBox.style.display = "inline";

	tipBox.style.top = clientY;
	tipBox.style.left = clientX;

	var tipHeader = document.getElementById("tipHeader");
	var tipBody = document.getElementById("tipBody");

	tipHeader.innerHTML = srcElement.innerHTML;
	tipBody.innerHTML = srcElement.parentElement.nextSibling.innerHTML;
}

function hideTip()
{
	tipBox.style.display = "none";
}

function insReElement(s1, s2)
{
	if (document.selection)
	{
		var re = document.getElementById("txtRegExp");
		re.focus();

		var txt = re.value;
		var str = document.selection.createRange();

		if (str.text == "") str.text = s1 + s2;
		else if (txt.indexOf(str.text) >= 0) str.text = s1 + str.text + s2;
		else re.value = txt + s1 + s2;

		str.select();
	}
}
